Skip to content

Conversation

@Ted-Jin-Lab
Copy link

@Ted-Jin-Lab Ted-Jin-Lab commented Nov 28, 2025

This commit refactors the ReadLinesAsync method to improve efficiency and memory usage when processing large files.

BREAKING CHANGE: The return type of ReadLinesAsync has been changed from Task<string[]> to IAsyncEnumerable.

Consumers of ReadLinesAsync must now use an async enumeration pattern (e.g., C# 8's await foreach) instead of awaiting a single array. This allows lines to be processed one by one as they are read from the source, avoiding the need to load all lines into memory simultaneously.

Test updates:

  • Related unit and integration tests have been updated to use the new IAsyncEnumerable<string> consumption pattern.

Fixes #1339

This commit refactors the ReadLinesAsync method to improve efficiency and memory usage when processing large files.

BREAKING CHANGE: The return type of ReadLinesAsync has been changed from Task<string[]> to IAsyncEnumerable<string>.

Consumers of ReadLinesAsync must now use an async enumeration pattern (e.g., C# 8's `await foreach`) instead of awaiting a single array. This allows lines to be processed one by one as they are read from the source, avoiding the need to load all lines into memory simultaneously.

Test updates:
* Related unit and integration tests have been updated to use the new `IAsyncEnumerable<string>` consumption pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] ReadLinesAsync return IAsyncEnumerable<string>

1 participant